package com.demo.controller;

import com.alibaba.fastjson.JSON;
import com.demo.dao.StudentDao;
import com.demo.mode.StudentEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MybatisController {

    private static final Logger logger = LoggerFactory.getLogger(MybatisController.class);

    @Autowired
    private StudentDao studentDao;

    @RequestMapping(value = "testMybatis")
    public String testMybatis(){
        List<StudentEntity> list = studentDao.getStudent("amy");
        logger.info(JSON.toJSONString(list));
        return "成功";
    }
}
